#include<iostream>
#include<vector>
using namespace std;
int getLongestPalindrome(string A) {
    int n = A.size();
    vector<vector<bool>>dp(n, vector<bool>(n, false));
    int mmax = 0;
    for (int i = n - 1; i >= 0; i--)
    {
        for (int j = i; j <= n - 1; j++)
        {
            if (A[i] == A[j])
            {
                if (j-i<=1) dp[i][j] = true;
                else if (dp[i + 1][j - 1]) dp[i][j] = true;
            }
            if (dp[i][j])
            {
                mmax = max(mmax, j - i + 1);
            }
        }

    }
    return mmax;
}
int main()
{
    string a = "ccbcabaabba";
    getLongestPalindrome(a);
    return 0;
}